﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.opensymphony.module.sitemesh.tapestry.Title"%>
<%@page import="com.sun.xml.txw2.Document"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp"/>
<fmt:setBundle basename="bundles.application-resources"/>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String Title = "";
Title = request.getHeader(Title);
String referer = request.getHeader("Referer");
if(referer==null) referer="";
%>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>运营配置</title>
</head>
<body>
<div class="page-content">
	<div class="page-header">
		<h1>运营配置<small><i class="icon-double-angle-right"></i> 配置平台相关参数 </small></h1>
	</div>
	<div class="container">
		<div class="row clearfix">
			<div class="col-xs-12">
				<button class="btn btn-primary btn-sm pull-right" onclick="saveEntity()" style="margin-left:15px;margin-top:-4px;padding:3px 7px"><i class="icon icon-ok"></i> 保存</button>
			</div>
			<div class="col-xs-12 column">
				<div class="tabbable" id="tabs-174028">
					<ul class="nav nav-tabs">
						<li class="active">
							 <a href="#tab1" data-toggle="tab">提现相关设置</a>
						</li>
						<li>
							 <a href="#tab2" data-toggle="tab">股东基金设置</a>
						</li>
						<li>
							 <a href="#tab3" data-toggle="tab">短信接口参数</a>
						</li>
						<li>
							 <a href="#tab-other" data-toggle="tab">其他配置</a>
						</li>
					</ul>
					<form id="editF">
					<div class="tab-content" id="editF">
						<div class="tab-pane active" id="tab1">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<div class="form-horizontal">
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 提现时间段</span>
											<div class="col-xs-7">
												<span class="fl" style="line-height:34px;">星期&nbsp;</span>
												<select id="startDate" class="form-control fl" style="width:50px;display: inline-block;">
													<c:forEach begin="1" end="7" var="vo">
													<option ${startDate==vo?'selected':'' } value="${vo }">${vo }</option>
													</c:forEach>
												</select>
												<span class="fl" style="line-height:34px;">&nbsp;</span>
												<div class="fl" style="display: inline-block;width: 160px;">
													<div class="input-group bootstrap-timepicker">
														<input id="timepicker1" type="text" class="form-control" value="${startTime }"/>
														<span class="input-group-addon">
															<i class="icon-time bigger-110"></i>
														</span>
													</div>
												</div>
												<span class="fl" style="line-height:34px;">&nbsp;　到　&nbsp;星期&nbsp;</span>
												<select id="endDate" class="form-control fl" style="width:50px;display: inline-block;">
													<c:forEach begin="1" end="7" var="vo">
													<option ${endDate==vo?'selected':'' } value="${vo }">${vo }</option>
													</c:forEach>
												</select>
												<span class="fl" style="line-height:34px;">&nbsp;日&nbsp;</span>
												<div class="fl" style="display: inline-block;width: 160px;">
													<div class="input-group bootstrap-timepicker">
														<input id="timepicker2" type="text" class="form-control" value="${endTime }"/>
														<span class="input-group-addon">
															<i class="icon-time bigger-110"></i>
														</span>
													</div>
												</div>
											</div>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 提现费率</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_withdraw_rate" value="<my:config key="admin_withdraw_rate"/>" placeholder="建议(0 ≤ f ≤ 1)"/>
											</div>
											<span class="col-xs-5 control-label left no-padding-left">用户提现时需缴纳的比例</span>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 提现单位</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_withdraw_unit" value="<my:config key="admin_withdraw_unit"/>"/>
											</div>
											<span class="col-xs-5 control-label left no-padding-left">单位：元， 用户提现时只能提前该值的整数倍</span>
										</div>
									</div>
									</div>
								</div>
							</div>
						</div>
						<div class="tab-pane" id="tab2">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<div class="form-horizontal">
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 营业额转基金比例</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_fund_rate" value="<my:config key="admin_fund_rate"/>" placeholder="建议(0 ≤ f ≤ 1)"/>
											</div>
											<span class="col-xs-5 control-label left no-padding-left">公司将每日拿出这部分收益作为基金发给股东</span>
										</div>
										<c:forEach begin="1" end="6" var="p">
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> ${p }级股东小区业绩及分红权值</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_fund_threshold_level_${p }" value="<my:config key="admin_fund_threshold_level_${p }"/>" placeholder="最小业绩(元)"/>
											</div>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_fund_weight_level_${p }" value="<my:config key="admin_fund_weight_level_${p }"/>" placeholder="分红权值"/>
											</div>
										</div>
										</c:forEach>
									</div>
									</div>
								</div>
							</div>
						</div>
						<div class="tab-pane" id="tab3">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<div class="form-horizontal">
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> Server URL</span>
											<div class="col-xs-6">
												<input class="form-control" type="text" name="admin_sms_url" value="<my:config key="admin_sms_url"/>" placeholder="如：http://utf8.sms.webchinese.cn/"/>
											</div>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 用户名参数名及值</span>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_username_param" value="<my:config key="admin_sms_username_param"/>" placeholder="参数名称，如：Uid"/>
											</div>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_username_value" value="<my:config key="admin_sms_username_value"/>" placeholder="参数值，如：abcdef"/>
											</div>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 密码参数名及值</span>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_password_param" value="<my:config key="admin_sms_password_param"/>" placeholder="参数名称，如：Key"/>
											</div>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_password_value" value="<my:config key="admin_sms_password_value"/>" placeholder="参数值，如：123456"/>
											</div>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 手机及内容参数名</span>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_mobile_param" value="<my:config key="admin_sms_mobile_param"/>" placeholder="手机，如：smsMob"/>
											</div>
											<div class="col-xs-3">
												<input class="form-control" type="text" name="admin_sms_content_param" value="<my:config key="admin_sms_content_param"/>" placeholder="内容，如：smsText"/>
											</div>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 其他附加字符串</span>
											<div class="col-xs-6">
												<input class="form-control" type="text" name="admin_sms_other_str" value="<my:config key="admin_sms_other_str"/>" placeholder="其他附加字符串（可为空），如：&MSGTYPE=4"/>
											</div>
										</div>
									</div>
									</div>
								</div>
							</div>
						</div>
						
						<div class="tab-pane" id="tab-other">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<div class="form-horizontal">
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 收益管理费率</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_income_manage_rate" value="<my:config key="admin_income_manage_rate"/>" placeholder="建议(0 ≤ f ≤ 1)"/>
											</div>
											<span class="col-xs-5 control-label left no-padding-left">用户获得分享佣金或市场佣金时需缴纳的管理费比例</span>
										</div>
										<div class="form-group">
											<span class="col-xs-3 control-label"><span class="red"></span> 营业额转静态拨比比例</span>
											<div class="col-xs-2">
												<input class="form-control" type="text" name="admin_static_rate" value="<my:config key="admin_static_rate"/>" placeholder="建议(0 ≤ f ≤ 1)"/>
											</div>
											<span class="col-xs-5 control-label left no-padding-left">公司将每日拿出这部分收益作为静态拨比分发给未回本会员</span>
										</div>
										</div>
									</div>
								</div>
							</div>
						</div>
						
					</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div><!-- /.page-content -->
<script>
function getFormData(){
	var param = $('#editF').serializeObject();
	param['admin_withdraw_starttime'] = $('#startDate').val()+' '+$('#timepicker1').val();
	param['admin_withdraw_endtime'] = $('#endDate').val()+' '+$('#timepicker2').val();
	return param;
}

function saveEntity(){
	var param = getFormData();
	var count = 0;
	for(var k in param){
		if(k.indexOf('admin_')==0)count++;
	}
	for(var k in param){
		if(k.indexOf('admin_')==0){
			$.post("./setSysConfig", {id: k, value: param[k]}, function(resp){
				count--;
				if(count==0){
					bootbox.alert('<h4>提示：</h4>保存完毕！', function() {
						window.onbeforeunload = null;
					});
				}
			});
		}
	}
	showMsg('请求也提交！');
}
$(function(){
	$('#timepicker1,#timepicker2').timepicker({
		minuteStep: 1,
		showSeconds: true,
		showMeridian: false
	}).next().on(ace.click_event, function(){
		$(this).prev().focus();
	});
});
</script>
</body>
</html>